<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .wrapper{
            position: relative;
            width:300px;
            height:400px;
            border:1px solid #333;
            margin :100px auto;
            
        }
        .money{
            width:100%;
            height:100%;
            text-align: center;
            line-height: 400px;
            font-family: 'Courier New', Courier, monospace;
            opacity: 0;
            transition: opacity 0.5s linear;
        }
        .bao{
            position: absolute;
            top:0;
            width:100%;
            height:100%;
            overflow: hidden;
        }
        .one{
            width:100%;
            height:150px;
            background-color: orangered;
            transition: transform 0.5s linear 0.5s;
        }
        .two{
            width:100%;
            height:250px;
            background-color: red;
            transition: transform 0.5s linear 0.5s;
        }
        .th{
            position: absolute;
            left:50%;
            top:115px;
            margin-left:-50px;
            width:100px;
            height:70px;
            border-radius: 50%;
            background: green;
            text-align: center;
            line-height: 70px;
            transition: opacity 0.5s linear;
            cursor: pointer;
        }
        
        .activeOne{
            transform: translate(0,-100%);
            
        }
        .activeTwo{
            transform: translate(0,100%);
            
        }
        .activeTh{
            opacity: 0;
            
        }
        .activeMoney{
            opacity: 1;
        }
        .close{
            position: absolute;
            top: 350px;
            left: 140px;
            width:30px;
            height:30px;
            border-radius: 50%;
            opacity: 0;
            transition: opacity 0.5s linear 1s;
        }
        .close::before,
        .close:after{
            content:"";
            position: absolute;
            top:50%;
            left:0;
            width:30px;
            height:2px;
            margin-top:-1px;
            background: #333;
            
        }
        .close::before{
            transform: rotate(45deg);
        }
        .close::after{
            transform: rotate(-45deg);
        }
        .activeClose{
            opacity: 1;
        }
    </style>
</head>
<body>
    <div class="wrapper">
        <div class="money"></div>
        <div class="bao">
            <div class="one"></div>
            <div class="two"></div>
            <div class="th">拆</div>
        </div>
        <div class="close"></div>
    </div>
    
    <script src="./js/jquery-3.2.1.js"></script>
    <script>
        $(".th").click(function(){
            var money = Math.random()*20+1;
            var moneyData = money.toFixed(2);
            $(".money").addClass("activeMoney").html(moneyData+"元");
            $(".one").addClass("activeOne");
            $(".two").addClass("activeTwo");
            $(".th").addClass("activeTh");
            $(".close").addClass("activeClose");
        });
        $(".close").click(function(){
            $(".money").removeClass("activeMoney");
            $(".one").removeClass("activeOne");
            $(".two").removeClass("activeTwo");
            $(".th").removeClass("activeTh");
            $(".close").removeClass("activeClose");
        })
    </script>
</body>
</html>